package com.pan.config;


import com.pan.interceptor.OrderInterceptor;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

@Configuration
public class InterceptorConfig implements WebMvcConfigurer {

    @Override
    public void addInterceptors(InterceptorRegistry registry) {

        InterceptorRegistration registration = null;
        registry.addInterceptor(handlerOrderInterceptorNotAutoWiredQuestion()).addPathPatterns("/order/**");
//        registry.addInterceptor(new OrderInterceptor())
//                .addPathPatterns("/**");
    }

    @Bean
    public OrderInterceptor handlerOrderInterceptorNotAutoWiredQuestion(){
        return new OrderInterceptor();
    }
}
